/*
 *说明：命令日志 首页脚本
 *
 *@author liuxun 2012-04-06
*/

var opeForm;
var grid;

$(function(){
	opeForm = $('#opeForm');

	grid=$('#listTable').datagrid({
		columns:[[

            {title:'开始时间',field:'BEGIN_TIME',align:'center',width:80},

            {title:'命令',field:'CMD',align:'center',width:80}
        ]],
		pagination:true,
		singleSelect: false
	});

	queryOperation();

	$('#queryBtn').click(queryOperation);
	$('#clearBtn').click(clearOperation);
	$('#reloadBtn').click(refreshWin);
	$('#genReportBtn').click(genReporOperation);
});

//翻页时自动调用此函数
function onLoadPrev(msg){
	var queryParams=grid.datagrid('options').queryParams;
	queryParams['firstQuery']=false;
}

//查询操作
function queryOperation(){
	var params = opeForm.serializeObject();
	grid.datagrid("options").pageNumber = 1;
	grid.datagrid({
		url: 'E_CMD_LOG!queryList.do',
		queryParams: jQuery.extend({}, params, {'firstQuery': true})
	});
}

//清空操作（重置）
function clearOperation() {
	opeForm.resetForm();
}

//添加命令日志
function genReporOperation(){  
	var url = 'AUDIT_REPORT!genCmdLogReport.do';
	openWin(url,'pop');
}

//操作成功后刷新列表
function afterOK(){
	queryOperation();
}